#!/bin/bash

#**************************************************************
#*                                                            *
#*      cleanup_files                                         *
#*                                                            *
#**************************************************************

function cleanup_files {
#
rm -f  *_out 
rm -f  *~ >& /dev/null
rm -f energy  >& /dev/null
rm -f *_db >& /dev/null
rm -f wn*  >& /dev/null
rm -f we*  >& /dev/null
rm -f step*.rest  >& /dev/null
rm -f states*  >& /dev/null
#
}

#**************************************************************
#*                                                            *
#*      run_and_compare                                       *
#*                                                            *
#**************************************************************

function run_and_compare {
#
echo "  ... running hypre solver test (takes 8-10 mins) ..."
"$warp3d" $ranks_warp3d $threads_warp3d  < test_hybrid > test_hybrid_out
#
echo "  ... WARP3D job completed ..."
#
# Check
#
perl check.perl
cleanup_files
printf ">>> All done with hypre-test-long\n\n"
#
}

#**************************************************************
#*                                                            *
#*      Main program                                          *
#*                                                            *
#**************************************************************
run_and_compare
